<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateOrdersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('orders', function (Blueprint $table) {
            $table->increments('id');
            $table->unsignedBigInteger('code')->nullable();
            $table->integer('member_id');
            $table->string('phone',20);
            $table->string('name',10);
            $table->string('start');
            $table->string('start_address');
            $table->decimal('start_lat',10,7);
            $table->decimal('start_lng',10,7);
            $table->string('end');
            $table->string('end_address');
            $table->decimal('end_lat',10,7);
            $table->decimal('end_lng',10,7);
            $table->dateTime('date');                       //乘客要求的上车时间
            $table->tinyInteger('status')->default(0);
            $table->decimal('amount',10,2)->nullable();
            $table->integer('driver_id')->nullable();
            $table->timestamp('dispatch_at')->nullable();       //发车时间（实际发车时间）
            $table->string('fail_msg')->nullable();       //无法出票原因

            $table->timestamp('paid_at')->nullable();
            $table->timestamps();
            $table->softDeletes();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('orders');
    }
}
